import { utilJs } from "@/utils/common.js";
import { goDetails, goSubCategory } from "@/utils/goDetails.js"
export const officialIndex = {
  data() {
    return {
      navMap: global.navMap,
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
    }
  },
  methods: {
    clickSwiperItem(linkUrl) {
      utilJs.locationHref(linkUrl, this);
    },
    //点击导航
    clickNavItem(index, navId) {
      let curNavId = navId;
      switch (curNavId) {
        case "gzhShow":
          this.$store.commit('updateShowAttentionQr', true);
          break;
        case "addTeacher":
          this.$store.commit('updateShowAddTeacher', true);
          break;
        default:
          this.$routerGo(this, "push", {
            path: this.navMap[curNavId].link
          });
          break;
      }
    },
    // 优惠券
    goValueVoucherList: function () {
      goDetails(this, global.ckFrom.coupon, '', {isList: 1}, '', 1);
    },
    //点击课程预告
    clickCourseForenotice(id) {
      this.$routerGo(this, "push", {
        path: "/homePage/course/courseForenotice",
        query: { cId: id }
      });
    },
    // 点击课程预告二维码
    clickForenoticeQrcode(id) {
      this.$routerGo(this, "push", {
        path: "/homePage/course/courseForenoticeQrcode",
        query: { cId: id }
      });
    },
    goColumn: function () {
      goDetails(this, global.ckFrom.column, '', {isList: 1}, '', 1);
    },
    // 点击专栏
    clickColumn(columnNo) {
      goDetails(this, global.ckFrom.column, columnNo, '', '', 1);
    },
    // 点击精品课程查看
    clickGoCourseSearch(e) {
      //点击精品课程查看
      this.$routerGo(this, "push", {
        path: "/homePage/search/searchList"
      });
    },
    clickCourseItem(courseId, type) {
      goDetails(this, global.ckFrom.course, courseId, '', type, 1);
    },
    // 查看所有课程分类
    clickAllCategory(e) {
      this.$routerGo(this, "push", { path: "/homePage/course/courseCategory" });
    },
    // 点击资料库下载
    clickGoDatum() {
      goDetails(this, global.ckFrom.datum, '', {isList: 1}, '', 1);
    },
    clickSubCategory(cateId1, cateId2, cateId3, name) {
      goSubCategory(this, this.categoryLevel, this.categoryTheme, cateId1, cateId2, cateId3, name);
    },
    // 查看所有可预约列表
    clickMoreBooking(e) {
      goDetails(this, global.ckFrom.booking, '', {isList: 1}, '', 1);
    },
    // 点击问答专区
    clickGoQA() {
      goDetails(this, global.ckFrom.qa, '', {isList: 1}, '', 1);
    },
    // 点击线上商城更多
    clickGoShop(e) {
      goDetails(this, global.ckFrom.mall, this.companyAuth.mallPageId, {isList: 1}, '', 1);
    },
    // 点击商品
    clickShop(shopNo) {
      goDetails(this, global.ckFrom.shopping, shopNo, '', '', 1)
    },
    // 点击测试列表
    clickExaminationItem(examinationNo) {
      goDetails(this, global.ckFrom.exam, examinationNo, '', '', 1)
    },
    // 查看所有小班课列表
    clickMoreClassList(e) {
      goDetails(this, global.ckFrom.privateClass, '', {isList: 1}, '', 1);
    },
    // 点击测试更多
    clickMoreExamination(e) {
      goDetails(this, global.ckFrom.exam, '', {isList: 1}, '', 1);
    },
    // 点击社群更多
    clickMoreSocialGroup(e) {
      goDetails(this, global.ckFrom.social, '', {isList: 1}, '', 1);
    },
    // 点击社群列表
    clickSocailGroupItem(socailGroupNo) {
      goDetails(this, global.ckFrom.social, socailGroupNo, '', '', 1)
    },
    // 点击友情链接
    clickFirendLink(linkUrl) {
      if (!linkUrl) return
      if (!linkUrl.includes("http") && !linkUrl.includes("https")) {
        linkUrl = "http://" + linkUrl;
      }
      utilJs.locationHref(linkUrl, this);
    },
    // 点击考试更多
    clickMoreTestPaper(e) {
      goDetails(this, global.ckFrom.testpPaper, '', {isList: 1}, '', 1);
    },
    // 点击练习更多
    clickMoreQuestion(e) {
      goDetails(this, global.ckFrom.itemBank, '', {isList: 1}, '', 1);
    },
    // 点击会员到期提示语
    linkToVipUpgrade() {
      goDetails(this, global.ckFrom.vip, '', '', '', 1)
    },
    // 点击公司简介
    clickCompanyIntro() {
      this.$routerGo(this, "push", {
        path: "/homePage/about/companyProfile"
      });
    },
    // 点击联系我们
    clickContactUs() {
      this.$routerGo(this, "push", {
        path: "/homePage/about/contactUs"
      });
    },
  },
};
